<template>
    <div class="img-box">
        <img :src="imgSrc" alt="">
    </div>
</template>

<script>
import { downloadEnclosureHis } from "@/api/Common"; //下载图片
export default {
    props:['item'],
    data() {
        return {
            imgSrc: null
        }
    },
    watch: {
        /* 监听是否有已经上传的文件,通过接口展示 */
        item: {

            async handler(newVal, oldVal) {
                if (newVal.SectionResultStr != null) {
                    let res = await downloadEnclosureHis({
                        relationTableId: newVal.JobRecordDetailID,
                    });
                    if (res.Data != null) {
                        let { FilebyteStr, Name } = res.Data;
                        this.imgSrc = `data:image/png;base64,${FilebyteStr}`;
                        
                    }
                }
            },
            immediate: true,
            deep: true,
        },
    },
}
</script>

<style lang="less" scoped>
.img-box {
    height: 3.125rem;
    width: 6.25rem;

    img {
        height: 100%;
        width: 100%;
    }
}
</style>